package com.shilan.dllo.wangyi.adpter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.shilan.dllo.wangyi.factory.FragmentFactory;

/**
 * Created by dllo on 15/10/23.
 */
public class TabLayoutFragmentAdpter extends FragmentPagerAdapter{

    private String [] titles = {"头条","娱乐","热点","体育","财经","科技"};

    public TabLayoutFragmentAdpter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return FragmentFactory.createFragment(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    public  CharSequence getPageTitle(int position){
        return  titles[position];
    }
}
